#ifndef _CGRAPHIC_H
#define _CGRAPHIC_H

#include "d3d9.h"
#include "d3dx9.h"

class CGraphic
{
public:
	//-------------------------------------------//
	// Constructor and Destructor for this class //
	//-------------------------------------------//
	CGraphic	();
	CGraphic	(HWND hwnd,HINSTANCE hInstance,int width,int height,bool IsFullScreen);
	~CGraphic	();
	
	//--------------------------------//
	//	Public methods for this class //
	//--------------------------------//

	//Get function
	LPDIRECT3DDEVICE9	GetDevice				() const;
	LPD3DXSPRITE		GetSpriteHandler		() const;

	void				BeginRender				();
	void				EndRender				();
	void				ClearScreen				();
	
	//Init method 
	bool				Init					();
	bool				InitSpriteHandler		();

	void				Release					();

protected:
	//-------------------------------------//
	//	Protected variables for this class //
	//-------------------------------------//
	LPDIRECT3DDEVICE9		m_pD3dDevice; 
	LPDIRECT3D9				m_pD3d;
	HWND					m_hwnd;
	HINSTANCE				m_hInstance;
	D3DPRESENT_PARAMETERS	m_PresentPara;
	
	int						m_ScreenWidth;
	int						m_ScreenHeight;
	bool					m_IsFullScreen;

	LPD3DXSPRITE			m_pSpriteHandler;
	//--------------------------------//
	// Private methods for this class //
	//--------------------------------//
	D3DFORMAT	FindDepthStencilFormat	( ULONG AdapterOrdinal, D3DDISPLAYMODE Mode, D3DDEVTYPE DevType );
};

#endif